home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nojet / main.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-03-11  |  30.9 KB  |  940 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H8000000F&
  5.    BorderStyle     =   3  'Fixed Double
  6.    Caption         =   "Contact Database"
  7.    ClientHeight    =   5490
  8.    ClientLeft      =   1035
  9.    ClientTop       =   1440
  10.    ClientWidth     =   8835
  11.    ClipControls    =   0   'False
  12.    FontBold        =   0   'False
  13.    FontItalic      =   0   'False
  14.    FontName        =   "MS Sans Serif"
  15.    FontSize        =   8.25
  16.    FontStrikethru  =   0   'False
  17.    FontUnderline   =   0   'False
  18.    Height          =   5925
  19.    Icon            =   MAIN.FRX:0000
  20.    Left            =   960
  21.    LinkTopic       =   "Form1"
  22.    MaxButton       =   0   'False
  23.    ScaleHeight     =   5490
  24.    ScaleWidth      =   8835
  25.    Top             =   1080
  26.    Width           =   8985
  27.    Begin PictureClip picClip 
  28.       Cols            =   4
  29.       Location        =   "1140,720,4140,7560"
  30.       Picture         =   MAIN.FRX:0302
  31.       Rows            =   3
  32.    End
  33.    Begin PictureBox picDataCtl 
  34.       AutoRedraw      =   -1  'True
  35.       BackColor       =   &H8000000F&
  36.       ClipControls    =   0   'False
  37.       Height          =   270
  38.       Left            =   3840
  39.       ScaleHeight     =   240
  40.       ScaleWidth      =   1125
  41.       TabIndex        =   36
  42.       Top             =   4980
  43.       Width           =   1155
  44.       Begin Image imgDataCtl 
  45.          Enabled         =   0   'False
  46.          Height          =   240
  47.          Index           =   0
  48.          Left            =   0
  49.          Top             =   0
  50.          Width           =   285
  51.       End
  52.       Begin Image imgDataCtl 
  53.          Enabled         =   0   'False
  54.          Height          =   240
  55.          Index           =   1
  56.          Left            =   285
  57.          Top             =   0
  58.          Width           =   285
  59.       End
  60.       Begin Image imgDataCtl 
  61.          Enabled         =   0   'False
  62.          Height          =   240
  63.          Index           =   2
  64.          Left            =   555
  65.          Top             =   0
  66.          Width           =   285
  67.       End
  68.       Begin Image imgDataCtl 
  69.          Enabled         =   0   'False
  70.          Height          =   240
  71.          Index           =   3
  72.          Left            =   840
  73.          Top             =   0
  74.          Width           =   285
  75.       End
  76.    End
  77.    Begin CommandButton cmdButton 
  78.       Cancel          =   -1  'True
  79.       Caption         =   "&Find"
  80.       FontBold        =   0   'False
  81.       FontItalic      =   0   'False
  82.       FontName        =   "MS Sans Serif"
  83.       FontSize        =   8.25
  84.       FontStrikethru  =   0   'False
  85.       FontUnderline   =   0   'False
  86.       Height          =   375
  87.       Index           =   4
  88.       Left            =   7260
  89.       TabIndex        =   20
  90.       Top             =   2040
  91.       Width           =   1335
  92.    End
  93.    Begin CommandButton cmdButton 
  94.       Caption         =   "&Delete"
  95.       FontBold        =   0   'False
  96.       FontItalic      =   0   'False
  97.       FontName        =   "MS Sans Serif"
  98.       FontSize        =   8.25
  99.       FontStrikethru  =   0   'False
  100.       FontUnderline   =   0   'False
  101.       Height          =   375
  102.       Index           =   3
  103.       Left            =   7260
  104.       TabIndex        =   19
  105.       Top             =   1590
  106.       Width           =   1335
  107.    End
  108.    Begin CommandButton cmdButton 
  109.       Caption         =   "&New"
  110.       FontBold        =   0   'False
  111.       FontItalic      =   0   'False
  112.       FontName        =   "MS Sans Serif"
  113.       FontSize        =   8.25
  114.       FontStrikethru  =   0   'False
  115.       FontUnderline   =   0   'False
  116.       Height          =   375
  117.       Index           =   2
  118.       Left            =   7260
  119.       TabIndex        =   18
  120.       Top             =   1140
  121.       Width           =   1335
  122.    End
  123.    Begin Ctl3D Ctl3D 
  124.       ClassList       =   MAIN.FRX:0AFC
  125.       IgnoreColors    =   -1  'True
  126.       Left            =   8280
  127.       No3DMenus       =   -1  'True
  128.       Top             =   4920
  129.    End
  130.    Begin CommandButton cmdButton 
  131.       Caption         =   "Save"
  132.       Default         =   -1  'True
  133.       FontBold        =   0   'False
  134.       FontItalic      =   0   'False
  135.       FontName        =   "MS Sans Serif"
  136.       FontSize        =   8.25
  137.       FontStrikethru  =   0   'False
  138.       FontUnderline   =   0   'False
  139.       Height          =   375
  140.       Index           =   0
  141.       Left            =   7260
  142.       TabIndex        =   16
  143.       Top             =   240
  144.       Width           =   1335
  145.    End
  146.    Begin CommandButton cmdButton 
  147.       Caption         =   "Cancel"
  148.       FontBold        =   0   'False
  149.       FontItalic      =   0   'False
  150.       FontName        =   "MS Sans Serif"
  151.       FontSize        =   8.25
  152.       FontStrikethru  =   0   'False
  153.       FontUnderline   =   0   'False
  154.       Height          =   375
  155.       Index           =   1
  156.       Left            =   7260
  157.       TabIndex        =   17
  158.       Top             =   690
  159.       Width           =   1335
  160.    End
  161.    Begin TextBox txtCustData 
  162.       DataField       =   "E-Mail"
  163.       DataSource      =   "datCtl"
  164.       FontBold        =   0   'False
  165.       FontItalic      =   0   'False
  166.       FontName        =   "MS Sans Serif"
  167.       FontSize        =   8.25
  168.       FontStrikethru  =   0   'False
  169.       FontUnderline   =   0   'False
  170.       Height          =   300
  171.       Index           =   13
  172.       Left            =   1230
  173.       MaxLength       =   30
  174.       TabIndex        =   14
  175.       Top             =   4350
  176.       Width           =   1935
  177.    End
  178.    Begin TextBox txtCustData 
  179.       DataField       =   "Country"
  180.       DataSource      =   "datCtl"
  181.       FontBold        =   0   'False
  182.       FontItalic      =   0   'False
  183.       FontName        =   "MS Sans Serif"
  184.       FontSize        =   8.25
  185.       FontStrikethru  =   0   'False
  186.       FontUnderline   =   0   'False
  187.       Height          =   300
  188.       Index           =   9
  189.       Left            =   5355
  190.       MaxLength       =   30
  191.       TabIndex        =   10
  192.       Top             =   2325
  193.       Width           =   1605
  194.    End
  195.    Begin TextBox txtCustData 
  196.       DataField       =   "Zip"
  197.       DataSource      =   "datCtl"
  198.       FontBold        =   0   'False
  199.       FontItalic      =   0   'False
  200.       FontName        =   "MS Sans Serif"
  201.       FontSize        =   8.25
  202.       FontStrikethru  =   0   'False
  203.       FontUnderline   =   0   'False
  204.       Height          =   300
  205.       Index           =   8
  206.       Left            =   4140
  207.       MaxLength       =   10
  208.       TabIndex        =   9
  209.       Top             =   2325
  210.       Width           =   1125
  211.    End
  212.    Begin TextBox txtCustData 
  213.       DataField       =   "State"
  214.       DataSource      =   "datCtl"
  215.       FontBold        =   0   'False
  216.       FontItalic      =   0   'False
  217.       FontName        =   "MS Sans Serif"
  218.       FontSize        =   8.25
  219.       FontStrikethru  =   0   'False
  220.       FontUnderline   =   0   'False
  221.       Height          =   300
  222.       Index           =   7
  223.       Left            =   2925
  224.       MaxLength       =   30
  225.       TabIndex        =   8
  226.       Top             =   2325
  227.       Width           =   1125
  228.    End
  229.    Begin TextBox txtCustData 
  230.       DataField       =   "Address 1"
  231.       DataSource      =   "datCtl"
  232.       FontBold        =   0   'False
  233.       FontItalic      =   0   'False
  234.       FontName        =   "MS Sans Serif"
  235.       FontSize        =   8.25
  236.       FontStrikethru  =   0   'False
  237.       FontUnderline   =   0   'False
  238.       Height          =   300
  239.       Index           =   4
  240.       Left            =   1230
  241.       MaxLength       =   30
  242.       TabIndex        =   5
  243.       Top             =   1725
  244.       Width           =   2820
  245.    End
  246.    Begin TextBox txtCustData 
  247.       DataField       =   "Address 2"
  248.       DataSource      =   "datCtl"
  249.       FontBold        =   0   'False
  250.       FontItalic      =   0   'False
  251.       FontName        =   "MS Sans Serif"
  252.       FontSize        =   8.25
  253.       FontStrikethru  =   0   'False
  254.       FontUnderline   =   0   'False
  255.       Height          =   300
  256.       Index           =   5
  257.       Left            =   4140
  258.       MaxLength       =   30
  259.       TabIndex        =   6
  260.       Top             =   1725
  261.       Width           =   2820
  262.    End
  263.    Begin TextBox txtCustData 
  264.       DataField       =   "Fax"
  265.       DataSource      =   "datCtl"
  266.       FontBold        =   0   'False
  267.       FontItalic      =   0   'False
  268.       FontName        =   "MS Sans Serif"
  269.       FontSize        =   8.25
  270.       FontStrikethru  =   0   'False
  271.       FontUnderline   =   0   'False
  272.       Height          =   300
  273.       Index           =   12
  274.       Left            =   1230
  275.       MaxLength       =   15
  276.       TabIndex        =   13
  277.       Top             =   3750
  278.       Width           =   1935
  279.    End
  280.    Begin ComboBox cboCustData 
  281.       FontBold        =   0   'False
  282.       FontItalic      =   0   'False
  283.       FontName        =   "MS Sans Serif"
  284.       FontSize        =   8.25
  285.       FontStrikethru  =   0   'False
  286.       FontUnderline   =   0   'False
  287.       Height          =   300
  288.       Left            =   300
  289.       TabIndex        =   0
  290.       Top             =   525
  291.       Width           =   760
  292.    End
  293.    Begin TextBox txtCustData 
  294.       DataField       =   "Extension"
  295.       DataSource      =   "datCtl"
  296.       FontBold        =   0   'False
  297.       FontItalic      =   0   'False
  298.       FontName        =   "MS Sans Serif"
  299.       FontSize        =   8.25
  300.       FontStrikethru  =   0   'False
  301.       FontUnderline   =   0   'False
  302.       Height          =   300
  303.       Index           =   11
  304.       Left            =   2520
  305.       MaxLength       =   10
  306.       TabIndex        =   12
  307.       Top             =   3150
  308.       Width           =   645
  309.    End
  310.    Begin TextBox txtCustData 
  311.       DataField       =   "Title"
  312.       DataSource      =   "datCtl"
  313.       FontBold        =   0   'False
  314.       FontItalic      =   0   'False
  315.       FontName        =   "MS Sans Serif"
  316.       FontSize        =   8.25
  317.       FontStrikethru  =   0   'False
  318.       FontUnderline   =   0   'False
  319.       Height          =   300
  320.       Index           =   3
  321.       Left            =   4140
  322.       MaxLength       =   30
  323.       TabIndex        =   4
  324.       Top             =   1125
  325.       Width           =   2820
  326.    End
  327.    Begin TextBox txtCustData 
  328.       DataField       =   "Company"
  329.       DataSource      =   "datCtl"
  330.       FontBold        =   0   'False
  331.       FontItalic      =   0   'False
  332.       FontName        =   "MS Sans Serif"
  333.       FontSize        =   8.25
  334.       FontStrikethru  =   0   'False
  335.       FontUnderline   =   0   'False
  336.       Height          =   300
  337.       Index           =   2
  338.       Left            =   1230
  339.       MaxLength       =   30
  340.       TabIndex        =   3
  341.       Top             =   1125
  342.       Width           =   2820
  343.    End
  344.    Begin TextBox txtCustData 
  345.       DataField       =   "Comment"
  346.       DataSource      =   "datCtl"
  347.       FontBold        =   0   'False
  348.       FontItalic      =   0   'False
  349.       FontName        =   "MS Sans Serif"
  350.       FontSize        =   8.25
  351.       FontStrikethru  =   0   'False
  352.       FontUnderline   =   0   'False
  353.       Height          =   1500
  354.       Index           =   14
  355.       Left            =   3315
  356.       MultiLine       =   -1  'True
  357.       ScrollBars      =   2  'Vertical
  358.       TabIndex        =   15
  359.       Top             =   3150
  360.       Width           =   3660
  361.    End
  362.    Begin TextBox txtCustData 
  363.       DataField       =   "City"
  364.       DataSource      =   "datCtl"
  365.       FontBold        =   0   'False
  366.       FontItalic      =   0   'False
  367.       FontName        =   "MS Sans Serif"
  368.       FontSize        =   8.25
  369.       FontStrikethru  =   0   'False
  370.       FontUnderline   =   0   'False
  371.       Height          =   300
  372.       Index           =   6
  373.       Left            =   1230
  374.       MaxLength       =   30
  375.       TabIndex        =   7
  376.       Top             =   2325
  377.       Width           =   1605
  378.    End
  379.    Begin TextBox txtCustData 
  380.       DataField       =   "Phone"
  381.       DataSource      =   "datCtl"
  382.       FontBold        =   0   'False
  383.       FontItalic      =   0   'False
  384.       FontName        =   "MS Sans Serif"
  385.       FontSize        =   8.25
  386.       FontStrikethru  =   0   'False
  387.       FontUnderline   =   0   'False
  388.       Height          =   300
  389.       Index           =   10
  390.       Left            =   1230
  391.       MaxLength       =   15
  392.       TabIndex        =   11
  393.       Top             =   3150
  394.       Width           =   1200
  395.    End
  396.    Begin TextBox txtCustData 
  397.       DataField       =   "First Name"
  398.       DataSource      =   "datCtl"
  399.       FontBold        =   0   'False
  400.       FontItalic      =   0   'False
  401.       FontName        =   "MS Sans Serif"
  402.       FontSize        =   8.25
  403.       FontStrikethru  =   0   'False
  404.       FontUnderline   =   0   'False
  405.       Height          =   300
  406.       Index           =   1
  407.       Left            =   2925
  408.       MaxLength       =   20
  409.       TabIndex        =   2
  410.       Top             =   525
  411.       Width           =   1125
  412.    End
  413.    Begin TextBox txtCustData 
  414.       DataField       =   "Last Name"
  415.       DataSource      =   "datCtl"
  416.       FontBold        =   0   'False
  417.       FontItalic      =   0   'False
  418.       FontName        =   "MS Sans Serif"
  419.       FontSize        =   8.25
  420.       FontStrikethru  =   0   'False
  421.       FontUnderline   =   0   'False
  422.       Height          =   300
  423.       Index           =   0
  424.       Left            =   1230
  425.       MaxLength       =   30
  426.       TabIndex        =   1
  427.       Top             =   525
  428.       Width           =   1605
  429.    End
  430.    Begin Label lblCustData 
  431.       AutoSize        =   -1  'True
  432.       BackColor       =   &H8000000F&
  433.       Caption         =   "E-Mail:"
  434.       FontBold        =   0   'False
  435.       FontItalic      =   0   'False
  436.       FontName        =   "MS Sans Serif"
  437.       FontSize        =   8.25
  438.       FontStrikethru  =   0   'False
  439.       FontUnderline   =   0   'False
  440.       Height          =   195
  441.       Index           =   13
  442.       Left            =   1230
  443.       TabIndex        =   35
  444.       Top             =   4110
  445.       Width           =   480
  446.    End
  447.    Begin Label lblCustData 
  448.       AutoSize        =   -1  'True
  449.       BackColor       =   &H8000000F&
  450.       Caption         =   "Country:"
  451.       FontBold        =   0   'False
  452.       FontItalic      =   0   'False
  453.       FontName        =   "MS Sans Serif"
  454.       FontSize        =   8.25
  455.       FontStrikethru  =   0   'False
  456.       FontUnderline   =   0   'False
  457.       Height          =   195
  458.       Index           =   9
  459.       Left            =   5355
  460.       TabIndex        =   21
  461.       Top             =   2085
  462.       Width           =   585
  463.    End
  464.    Begin Label lblCustData 
  465.       AutoSize        =   -1  'True
  466.       BackColor       =   &H8000000F&
  467.       Caption         =   "Zip:"
  468.       FontBold        =   0   'False
  469.       FontItalic      =   0   'False
  470.       FontName        =   "MS Sans Serif"
  471.       FontSize        =   8.25
  472.       FontStrikethru  =   0   'False
  473.       FontUnderline   =   0   'False
  474.       Height          =   195
  475.       Index           =   8
  476.       Left            =   4140
  477.       TabIndex        =   34
  478.       Top             =   2085
  479.       Width           =   270
  480.    End
  481.    Begin Label lblCustData 
  482.       AutoSize        =   -1  'True
  483.       BackColor       =   &H8000000F&
  484.       Caption         =   "State:"
  485.       FontBold        =   0   'False
  486.       FontItalic      =   0   'False
  487.       FontName        =   "MS Sans Serif"
  488.       FontSize        =   8.25
  489.       FontStrikethru  =   0   'False
  490.       FontUnderline   =   0   'False
  491.       Height          =   195
  492.       Index           =   7
  493.       Left            =   2925
  494.       TabIndex        =   33
  495.       Top             =   2085
  496.       Width           =   420
  497.    End
  498.    Begin Label lblCustData 
  499.       AutoSize        =   -1  'True
  500.       BackColor       =   &H8000000F&
  501.       Caption         =   "Address 2:"
  502.       FontBold        =   0   'False
  503.       FontItalic      =   0   'False
  504.       FontName        =   "MS Sans Serif"
  505.       FontSize        =   8.25
  506.       FontStrikethru  =   0   'False
  507.       FontUnderline   =   0   'False
  508.       Height          =   195
  509.       Index           =   5
  510.       Left            =   4140
  511.       TabIndex        =   32
  512.       Top             =   1485
  513.       Width           =   750
  514.    End
  515.    Begin Label lblCustData 
  516.       AutoSize        =   -1  'True
  517.       BackColor       =   &H8000000F&
  518.       Caption         =   "Fax:"
  519.       FontBold        =   0   'False
  520.       FontItalic      =   0   'False
  521.       FontName        =   "MS Sans Serif"
  522.       FontSize        =   8.25
  523.       FontStrikethru  =   0   'False
  524.       FontUnderline   =   0   'False
  525.       Height          =   195
  526.       Index           =   12
  527.       Left            =   1230
  528.       TabIndex        =   31
  529.       Top             =   3510
  530.       Width           =   300
  531.    End
  532.    Begin Label lblCustData 
  533.       AutoSize        =   -1  'True
  534.       BackColor       =   &H8000000F&
  535.       Caption         =   "Ext:"
  536.       FontBold        =   0   'False
  537.       FontItalic      =   0   'False
  538.       FontName        =   "MS Sans Serif"
  539.       FontSize        =   8.25
  540.       FontStrikethru  =   0   'False
  541.       FontUnderline   =   0   'False
  542.       Height          =   195
  543.       Index           =   11
  544.       Left            =   2520
  545.       TabIndex        =   30
  546.       Top             =   2910
  547.       Width           =   270
  548.    End
  549.    Begin Label lblCustData 
  550.       AutoSize        =   -1  'True
  551.       BackColor       =   &H8000000F&
  552.       Caption         =   "Title:"
  553.       FontBold        =   0   'False
  554.       FontItalic      =   0   'False
  555.       FontName        =   "MS Sans Serif"
  556.       FontSize        =   8.25
  557.       FontStrikethru  =   0   'False
  558.       FontUnderline   =   0   'False
  559.       Height          =   195
  560.       Index           =   3
  561.       Left            =   4140
  562.       TabIndex        =   29
  563.       Top             =   885
  564.       Width           =   345
  565.    End
  566.    Begin Label lblCustData 
  567.       AutoSize        =   -1  'True
  568.       BackColor       =   &H8000000F&
  569.       Caption         =   "Company:"
  570.       FontBold        =   0   'False
  571.       FontItalic      =   0   'False
  572.       FontName        =   "MS Sans Serif"
  573.       FontSize        =   8.25
  574.       FontStrikethru  =   0   'False
  575.       FontUnderline   =   0   'False
  576.       Height          =   195
  577.       Index           =   2
  578.       Left            =   1230
  579.       TabIndex        =   28
  580.       Top             =   885
  581.       Width           =   705
  582.    End
  583.    Begin Label lblCustData 
  584.       AutoSize        =   -1  'True
  585.       BackColor       =   &H8000000F&
  586.       Caption         =   "Comments:"
  587.       FontBold        =   0   'False
  588.       FontItalic      =   0   'False
  589.       FontName        =   "MS Sans Serif"
  590.       FontSize        =   8.25
  591.       FontStrikethru  =   0   'False
  592.       FontUnderline   =   0   'False
  593.       Height          =   195
  594.       Index           =   14
  595.       Left            =   3315
  596.       TabIndex        =   27
  597.       Top             =   2910
  598.       Width           =   780
  599.    End
  600.    Begin Label lblCustData 
  601.       AutoSize        =   -1  'True
  602.       BackColor       =   &H8000000F&
  603.       Caption         =   "City:"
  604.       FontBold        =   0   'False
  605.       FontItalic      =   0   'False
  606.       FontName        =   "MS Sans Serif"
  607.       FontSize        =   8.25
  608.       FontStrikethru  =   0   'False
  609.       FontUnderline   =   0   'False
  610.       Height          =   195
  611.       Index           =   6
  612.       Left            =   1230
  613.       TabIndex        =   26
  614.       Top             =   2085
  615.       Width           =   300
  616.    End
  617.    Begin Label lblCustData 
  618.       AutoSize        =   -1  'True
  619.       BackColor       =   &H8000000F&
  620.       Caption         =   "Phone:"
  621.       FontBold        =   0   'False
  622.       FontItalic      =   0   'False
  623.       FontName        =   "MS Sans Serif"
  624.       FontSize        =   8.25
  625.       FontStrikethru  =   0   'False
  626.       FontUnderline   =   0   'False
  627.       Height          =   195
  628.       Index           =   10
  629.       Left            =   1230
  630.       TabIndex        =   25
  631.       Top             =   2910
  632.       Width           =   510
  633.    End
  634.    Begin Label lblCustData 
  635.       AutoSize        =   -1  'True
  636.       BackColor       =   &H8000000F&
  637.       Caption         =   "First Name:"
  638.       FontBold        =   0   'False
  639.       FontItalic      =   0   'False
  640.       FontName        =   "MS Sans Serif"
  641.       FontSize        =   8.25
  642.       FontStrikethru  =   0   'False
  643.       FontUnderline   =   0   'False
  644.       Height          =   195
  645.       Index           =   1
  646.       Left            =   2925
  647.       TabIndex        =   24
  648.       Top             =   300
  649.       Width           =   795
  650.    End
  651.    Begin Label lblCustData 
  652.       AutoSize        =   -1  'True
  653.       BackColor       =   &H8000000F&
  654.       Caption         =   "Last Name:"
  655.       FontBold        =   0   'False
  656.       FontItalic      =   0   'False
  657.       FontName        =   "MS Sans Serif"
  658.       FontSize        =   8.25
  659.       FontStrikethru  =   0   'False
  660.       FontUnderline   =   0   'False
  661.       Height          =   195
  662.       Index           =   0
  663.       Left            =   1230
  664.       TabIndex        =   23
  665.       Top             =   300
  666.       Width           =   810
  667.    End
  668.    Begin Label lblCustData 
  669.       AutoSize        =   -1  'True
  670.       BackColor       =   &H8000000F&
  671.       Caption         =   "Address 1:"
  672.       FontBold        =   0   'False
  673.       FontItalic      =   0   'False
  674.       FontName        =   "MS Sans Serif"
  675.       FontSize        =   8.25
  676.       FontStrikethru  =   0   'False
  677.       FontUnderline   =   0   'False
  678.       Height          =   195
  679.       Index           =   4
  680.       Left            =   1230
  681.       TabIndex        =   22
  682.       Top             =   1485
  683.       Width           =   750
  684.    End
  685. DefInt A-Z
  686. Option Explicit
  687. Const MODAL = 1
  688. 'Flags var & constants
  689. Dim iFlags As Integer
  690. Const FL_DATACHANGED = 1
  691. Const FL_KEYCHANGED = 2
  692. 'Index pointer
  693. Dim lRecNo As Long
  694. 'User-defined types
  695. Dim udtContact As Contact
  696. Dim udtComment As Comment
  697. Dim udtIndex As ContactIndex
  698. Sub cmdButton_Click (Index As Integer)
  699.     Dim lResult As Long
  700.     Dim sFName As String
  701.     Dim sLName As String
  702.     Dim sTarget As String
  703.     Dim udtTemp As Contact
  704.     Select Case Index
  705.         Case 0      'Save
  706.             If (iFlags And FL_DATACHANGED) Then
  707.                 Call ContactSave(lRecNo)
  708.                 iFlags = iFlags And (Not FL_DATACHANGED)
  709.             End If
  710.         Case 1      'Cancel
  711.             'Force lRecNo positive
  712.             '  (cancels AddNew if pending)
  713.             lRecNo = Abs(lRecNo)
  714.             'Refresh current record from file
  715.             '  (cancel changes)
  716.             Call ContactDisplay(lRecNo)
  717.             'Clear flags
  718.             iFlags = iFlags And (Not FL_DATACHANGED)
  719.             iFlags = iFlags And (Not FL_KEYCHANGED)
  720.         Case 2      'New
  721.             'Clear UDT
  722.             LSet udtContact = udtTemp
  723.             'Negative rec no means we're
  724.             '  adding a new one
  725.             lRecNo = -(lRecNo)
  726.             Call ContactDisplay(lRecNo)
  727.         Case 3      'Delete
  728.             If (udtContact.Link > 0) Then
  729.                 Call CommentDelete(udtContact.Link)
  730.             End If
  731.             Call ContactDelete(lRecNo)
  732.             Call IndexDelete(lRecNo)
  733.             Call ContactDisplay(lRecNo)
  734.         Case 4      'Find
  735.             frmSearch.Show MODAL
  736.             'If user pressed 'OK'...
  737.             If Val(frmSearch.Tag) = 0 Then
  738.                 sLName = RTrim$(frmSearch!txtCustData(0) & sNull)
  739.                 sFName = RTrim$(frmSearch!txtCustData(1) & sNull)
  740.                 'If user entered a first name...
  741.                 If Len(sFName) Then
  742.                     'Use udtTemp to pad last name
  743.                     udtTemp.LastName = sLName
  744.                     'Concatentate first name
  745.                     sTarget = udtTemp.LastName & sFName
  746.                 Else
  747.                     '...otherwise, just search on
  748.                     '  last name
  749.                     sTarget = sLName
  750.                 End If
  751.                 lResult = IndexSearch(sTarget)
  752.                 If lResult Then
  753.                     lRecNo = lResult
  754.                     Call ContactDisplay(lRecNo)
  755.                 Else
  756.                     Beep
  757.                 End If
  758.             End If
  759.             Unload frmSearch
  760.     End Select
  761.     Call NavBtnUpdate(lRecNo)
  762. End Sub
  763. Sub ContactDisplay (lRecNo As Long)
  764.     If lRecNo > 0 Then
  765.         'Get lRecNo from index and then
  766.         '  retrieve the contact it points to
  767.         Get hIdx, lRecNo, udtIndex
  768.         Get hDat, udtIndex.lRecNo, udtContact
  769.     End If
  770.     cboCustData.Text = RTrim$(udtContact.Salutation)
  771.     txtCustData(0).Text = RTrim$(udtContact.LastName)
  772.     txtCustData(1).Text = RTrim$(udtContact.FirstName)
  773.     txtCustData(2).Text = RTrim$(udtContact.Company)
  774.     txtCustData(3).Text = RTrim$(udtContact.Title)
  775.     txtCustData(4).Text = RTrim$(udtContact.Address_1)
  776.     txtCustData(5).Text = RTrim$(udtContact.Address_2)
  777.     txtCustData(6).Text = RTrim$(udtContact.City)
  778.     txtCustData(7).Text = RTrim$(udtContact.State)
  779.     txtCustData(8).Text = RTrim$(udtContact.ZipCode)
  780.     txtCustData(9).Text = RTrim$(udtContact.Country)
  781.     txtCustData(10).Text = RTrim$(udtContact.Phone)
  782.     txtCustData(11).Text = RTrim$(udtContact.Extension)
  783.     txtCustData(12).Text = RTrim$(udtContact.Fax)
  784.     txtCustData(13).Text = RTrim$(udtContact.EMail)
  785.     'Is there an associated comment?
  786.     If udtContact.Link > 0 Then
  787.         'If so, show it
  788.         Get hCmt, udtContact.Link, udtComment
  789.         txtCustData(14).Text = RTrim$(udtComment.Text)
  790.     Else
  791.         'Otherwise, clear text box
  792.         txtCustData(14).Text = sNull
  793.     End If
  794. End Sub
  795. Sub ContactSave (lRecNo As Long)
  796.     Dim sTemp As String
  797.     'Get comment from text box
  798.     sTemp = Trim$(txtCustData(14).Text)
  799.     'If there's a comment...
  800.     If Len(sTemp) Then
  801.         '...and there wasn't one before...
  802.         If udtContact.Link < 1 Then
  803.             'Get next available record number
  804.             udtContact.Link = FreeComment&(hCmt)
  805.         End If
  806.         '...otherwise use existing record
  807.         udtComment.Text = sTemp
  808.         Put hCmt, udtContact.Link, udtComment
  809.     Else
  810.         'If there's no comment, but there was
  811.         '  one when we started...
  812.         If udtContact.Link > 0 Then
  813.             'Delete existing comment
  814.             Call CommentDelete(udtContact.Link)
  815.             'Clear record pointer
  816.             udtContact.Link = 0
  817.         End If
  818.     End If
  819.     udtContact.Salutation = cboCustData.Text
  820.     udtContact.LastName = txtCustData(0).Text
  821.     udtContact.FirstName = txtCustData(1).Text
  822.     udtContact.Company = txtCustData(2).Text
  823.     udtContact.Title = txtCustData(3).Text
  824.     udtContact.Address_1 = txtCustData(4).Text
  825.     udtContact.Address_2 = txtCustData(5).Text
  826.     udtContact.City = txtCustData(6).Text
  827.     udtContact.State = txtCustData(7).Text
  828.     udtContact.ZipCode = txtCustData(8).Text
  829.     udtContact.Country = txtCustData(9).Text
  830.     udtContact.Phone = txtCustData(10).Text
  831.     udtContact.Extension = txtCustData(11).Text
  832.     udtContact.Fax = txtCustData(12).Text
  833.     udtContact.EMail = txtCustData(13).Text
  834.     If (lRecNo < 1) Then
  835.         'We're adding a new record
  836.         udtIndex.sKey = udtContact.LastName & udtContact.FirstName
  837.         udtIndex.lRecNo = FreeContact&(hDat)
  838.         Call IndexInsert(udtIndex)
  839.         'Set lRecNo to point at new record
  840.         lRecNo = IndexSearch(udtIndex.sKey)
  841.     ElseIf (iFlags And FL_KEYCHANGED) Then
  842.         'Get existing index rec for this contact
  843.         Get hIdx, lRecNo, udtIndex
  844.         'Delete old index entry
  845.         Call IndexDelete(lRecNo)
  846.         'Create new key and add it to index (without
  847.         '  changing the contact record to which it points)
  848.         udtIndex.sKey = udtContact.LastName & udtContact.FirstName
  849.         Call IndexInsert(udtIndex)
  850.         'Set current rec ptr to new index entry
  851.         lRecNo = IndexSearch(udtIndex.sKey)
  852.         'Clear the flag
  853.         iFlags = iFlags And (Not FL_KEYCHANGED)
  854.     End If
  855.     'Save contact record
  856.     Put hDat, udtIndex.lRecNo, udtContact
  857. End Sub
  858. Sub Form_Load ()
  859.     Dim I As Integer
  860.     'Populate cboCustData with
  861.     '  salutations...
  862.     cboCustData.AddItem "Mr."
  863.     cboCustData.AddItem "Mrs."
  864.     cboCustData.AddItem "Ms."
  865.     cboCustData.ListIndex = 0
  866.     'Open files
  867.     hDat = FileOpen(AppPath$() & "contacts.dat", Len(udtContact))
  868.     hIdx = FileOpen(AppPath$() & "contacts.idx", Len(udtIndex))
  869.     hCmt = FileOpen(AppPath$() & "comments.dat", Len(udtComment))
  870.     If lRecNo = 0 Then lRecNo = 1
  871.     Call ContactDisplay(lRecNo)
  872.     Call NavBtnUpdate(lRecNo)
  873.     'Define global strings
  874.     sNull = ""
  875. End Sub
  876. Sub Form_Unload (Cancel As Integer)
  877.     Close
  878.     End
  879. End Sub
  880. Sub imgDataCtl_MouseDown (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  881.     If (Button And 1) Then
  882.         imgDataCtl(Index).Picture = PicClip.GraphicCell(Index + 4)
  883.     End If
  884. End Sub
  885. Sub imgDataCtl_MouseUp (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  886.     Dim lRecs As Long
  887.     'Save current record if it has changed
  888.     If (iFlags And FL_DATACHANGED) Then
  889.         Call ContactSave(lRecNo)
  890.         iFlags = iFlags And (Not FL_DATACHANGED)
  891.     End If
  892.     imgDataCtl(Index).Picture = PicClip.GraphicCell(Index)
  893.     lRecs = LOF(hIdx) \ Len(udtIndex)
  894.     Select Case Index
  895.         Case 0
  896.             lRecNo = 1
  897.         Case 1
  898.             lRecNo = lRecNo - 1
  899.         Case 2
  900.             lRecNo = lRecNo + 1
  901.         Case 3
  902.             lRecNo = lRecs
  903.     End Select
  904.     Call ContactDisplay(lRecNo)
  905.     Call NavBtnUpdate(lRecNo)
  906. End Sub
  907. Sub NavBtnUpdate (lRecNo As Long)
  908.     Dim I As Integer
  909.     Dim lRecs As Long
  910.     'Enable/disable "data control" buttons based on
  911.     '  lRecNo's relation to number of recs in database
  912.     lRecs = LOF(hIdx) \ Len(udtIndex)
  913.     'Load "data control" with greyed-out buttons
  914.     '  (they're disabled by default)
  915.     For I = 0 To 3
  916.         imgDataCtl(I).Enabled = False
  917.         imgDataCtl(I).Picture = PicClip.GraphicCell(I + 8)
  918.     Next
  919.     If lRecNo > 1 Then
  920.         'Enable leftward navigation buttons
  921.         For I = 0 To 1
  922.             imgDataCtl(I).Enabled = True
  923.             imgDataCtl(I).Picture = PicClip.GraphicCell(I)
  924.         Next
  925.     End If
  926.     If lRecNo < lRecs Then
  927.         'Enable rightward navigation buttons
  928.         For I = 2 To 3
  929.             imgDataCtl(I).Enabled = True
  930.             imgDataCtl(I).Picture = PicClip.GraphicCell(I)
  931.         Next
  932.     End If
  933. End Sub
  934. Sub txtCustData_KeyPress (Index As Integer, KeyAscii As Integer)
  935.     iFlags = iFlags Or FL_DATACHANGED
  936.     If (Index = 0) Or (Index = 1) Then
  937.         iFlags = iFlags Or FL_KEYCHANGED
  938.     End If
  939. End Sub
  940.